/**
 * URL ENCODER
 *
 * LICENSE
 *
 * This source file is subject to the new BSD license that is bundled
 * with this page.
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please contact twitter
 * to @agniuek so we can send you a copy immediately.
 *  
 * @category   javascript
 * @package    js here
 * @copyright  Copyright (c) 2012 agniuek
 * @license    New BSD License
 */

var Encoder = {};
Encoder.TO_ENCODE = 'to_encode';
Encoder.ENCODE_RESULT = 'encode_result';
Encoder.TO_DECODE = 'to_decode';
Encoder.DECODE_RESULT = 'decode_result';

Encoder.encode_uri = function() {
	var encode_result = encodeURI( document.getElementById(Encoder.TO_DECODE).value);
        if( (encode_result == null) || (encode_result == "") ){
          return;
        }
		document.getElementById(Encoder.ENCODE_RESULT).innerHTML = encode_result;
}

Encoder.decode_uri=function () {
	var decode_uri = decodeURI( document.getElementById(Encoder.TO_DECODE).value);
        if( (decode_uri == null) || ( decode_uri== "") ){
          return;
        }
	var decode_result = decode_uri.replace(/</g , "&lt;");
	document.getElementById(Encoder.DECODE_RESULT).innerHTML = decode_result;
}
